//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.family;

import java.io.Serializable;
import java.math.BigDecimal;

public class Family
        implements Serializable {

    public Family() {
    }

    public Family(String id, String designation, BigDecimal coefficient, String updateUserId, String updateTime) {
        setId(id);
        setDesignation(designation);
        setCoefficient(coefficient);
        setUpdateUserId(updateUserId);
        setUpdateTime(updateTime);
    }

    public Family(Family otherData) {
        setId(otherData.getId());
        setDesignation(otherData.getDesignation());
        setCoefficient(otherData.getCoefficient());
        setUpdateUserId(otherData.getUpdateUserId());
        setUpdateTime(otherData.getUpdateTime());
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setDesignation(String designation) {
        this.designation = designation;
    }

    public String getDesignation() {
        return designation;
    }

    public void setCoefficient(BigDecimal coefficient) {
        this.coefficient = coefficient;
    }

    public BigDecimal getCoefficient() {
        return coefficient;
    }

    public void setUpdateUserId(String updateUserId) {
        this.updateUserId = updateUserId;
    }

    public String getUpdateUserId() {
        return updateUserId;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public String toString() {
        StringBuffer str = new StringBuffer("{");
        str.append("id=" + getId() + " " + "designation=" + getDesignation() + " " + "coefficient=" + getCoefficient() + " " + "updateUserId=" + getUpdateUserId() + " " + "updateTime=" + getUpdateTime());
        str.append('}');
        return str.toString();
    }

    public boolean equals(Object pOther) {
        if (pOther instanceof Family) {
            Family lTest = (Family) pOther;
            boolean lEquals = true;
            if (id == null) {
                lEquals = lEquals && lTest.id == null;
            } else {
                lEquals = lEquals && id.equals(lTest.id);
            }
            if (designation == null) {
                lEquals = lEquals && lTest.designation == null;
            } else {
                lEquals = lEquals && designation.equals(lTest.designation);
            }
            if (coefficient == null) {
                lEquals = lEquals && lTest.coefficient == null;
            } else {
                lEquals = lEquals && coefficient.equals(lTest.coefficient);
            }
            if (updateUserId == null) {
                lEquals = lEquals && lTest.updateUserId == null;
            } else {
                lEquals = lEquals && updateUserId.equals(lTest.updateUserId);
            }
            if (updateTime == null) {
                lEquals = lEquals && lTest.updateTime == null;
            } else {
                lEquals = lEquals && updateTime.equals(lTest.updateTime);
            }
            return lEquals;
        } else {
            return false;
        }
    }

    public int hashCode() {
        int result = 17;
        result = 37 * result + (id == null ? 0 : id.hashCode());
        result = 37 * result + (designation == null ? 0 : designation.hashCode());
        result = 37 * result + (coefficient == null ? 0 : coefficient.hashCode());
        result = 37 * result + (updateUserId == null ? 0 : updateUserId.hashCode());
        result = 37 * result + (updateTime == null ? 0 : updateTime.hashCode());
        return result;
    }
    private String id;
    private String designation;
    private BigDecimal coefficient;
    private String updateUserId;
    private String updateTime;
}
